home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
UUPC11QS.ARJ
/
MKDIR.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-11-21
|
2KB
|
63 lines
/*--------------------------------------------------------------------*/
/* m k d i r . c */
/* */
/* Support routines for UUPC/extended */
/* */
/* Changes Copyright 1990, 1991 (c) Andrew H. Derbyshire */
/* */
/* History: */
/* 21Nov1991 Break out of lib.c ahd */
/*--------------------------------------------------------------------*/
#include <direct.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
/*--------------------------------------------------------------------*/
/* UUPC/extended include files */
/*--------------------------------------------------------------------*/
#include "lib.h"
currentfile();
/*--------------------------------------------------------------------*/
/* M K D I R */
/* */
/* Like mkdir() but create intermediate directories as well */
/*--------------------------------------------------------------------*/
int MKDIR(const char *inpath)
{
char *cp;
char *path;
if (*inpath == '\0')
return 0;
path = strdup(inpath);
checkref(path);
cp = path ;
while ((cp = strchr(cp, '\\')) != nil(char)) {
*cp = '/';
}
/* see if we need to make any intermediate directories */
cp = path ;
while ((cp = strchr(cp, '/')) != nil(char)) {
*cp = '\0';
mkdir(path);
*cp = '/';
cp++;
}
free(path);
/* make last dir */
return mkdir(inpath);
} /*MKDIR*/